<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'list.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
<script type="text/javascript" src="<%=request.getContextPath() %>/resources/js/jquery-1.9.1.min.js"></script>

  </head>
  
  <body>
     <input id="add" value="新增"   type="button"  onclick="window.location.href='<%=request.getContextPath() %>/indeximg!toAddIndeximg.action'"  />
     <br><br>
     <table class="tbody_content" >
     	<tr>
	     	<td>ID</td>
	     	<td>名称</td>
	     	<td>标题</td>
	     	<td>图片地址</td>
	     	<td>排序</td>
	     	<td>是否启用</td>
	     	<td></td>
	     	<td></td>
     	</tr>
   		<c:forEach  var="info" items="${requestScope.resultMap.list}"  varStatus="xh">
     		<tr>
     			<td>${xh.count+requestScope.xh}</td>
     			<td>${info.mname}</td>
     			<td>${info.title}</td>
     			<td>${info.murl}</td>
     			<td ><input  type="text" name="orderid"  action="indeximg!updateClounm.action?type=orderid&id=${info.id}" value="${info.orderid}" style="width: 30px;"    /></td>
     			<td>${info.sfqy}</td>
     			<td><input  type="button" value="修改"  onclick="to('<%=request.getContextPath() %>/indeximg!detailsIndeximg.action?id=${info.id}&url=to_update');">&nbsp;&nbsp;</td>
     			<td><input  type="button" value="删除"  onclick="detele('是否删除该条数据？','<%=request.getContextPath() %>/indeximg!deleteIndeximg.action?id=${info.id} && murl=${info.murl}','<%=request.getContextPath() %>/indeximg!sreachIndeximg.action');">  </td>
     		</tr>
     	</c:forEach>
     </table>
     <script type="text/javascript" src="<%=request.getContextPath() %>/resources/js/common.js"></script>
  </body>
  <script type="text/javascript">
  	$(function(){
  	$(".tbody_content input[type=text] ").change(function(){  
	if($(this).val()==""){alert("请输入值");$(this).focus();return; }
	var oldvalue=$(this).val();
	$.ajax({
		type:'post',url:$(this).attr("action")+"&"+"val="+$(this).val(),
	    success: function (data, textStatus) {  var json = eval("(" + data + ")"); alert(json.MSG);if(json.STATUS != 1) {$(this).val(oldvalue);   } },
	    beforeSend: function () {},
	    error: function (XMLHttpRequest, textStatus, errorThrown) {alert("操作失败!");var oldvalue=$(this).val(); },
	    complete: function (XMLHttpRequest, textStatus, errorThrown) {  }
	});
});
  	
  	});
  </script>
</html>
